import axios from '../../axios';
const PRODUCT_URL = "/products";

const productsApi = {
    //获得所有商品
    getALLProducts(data) {
        return axios({
            url: PRODUCT_URL + '/getAllProducts',
            method: 'get',
            params: data
        })
    },
    //新增商品
    addPro(data) {
        return axios({
            url: PRODUCT_URL + '/addOneProduct',
            method: 'post',
            data
        })
    },
    //删除商品
    deleteProduct(_id) {
        return axios({
            url: PRODUCT_URL + '/deleteOneProduct',
            method: 'post',
            data: _id
        })
    },

    //获得要修改的产品的信息
    getOneProduct(data) {
        return axios({
            url: PRODUCT_URL + '/getOneProduct',
            method: 'post',
            data
        })
    },
    modifyOnePro(data) {
        return axios({
            url: PRODUCT_URL + '/updateOneProduct',
            method: 'post',
            data
        })
    }
}

export default productsApi;